//
//  BarberDetailsView.m
//  afn
//
//  Created by mac on 2018/5/8.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "BarberDetailsView.h"
#import "BarberDetailsTableViewCell.h"
@implementation BarberDetailsView
-(void)creatView{
    _tableView=[BaseTableView new];
    [self addSubview:_tableView];
    [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(0);
        make.bottom.mas_equalTo(-50);
    }];
    _tableView.dataSource=self;
    _tableView.delegate=self;
    _tableView.backgroundColor=_LightGrey;
    
    UIButton *btn=[UIButton new];
    [self addSubview:btn];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.height.mas_equalTo(50);
    }];
    btn.backgroundColor=_backgroundColor;
    [btn setTitle:@"立即电话预约" forState:0];
    [btn setTitleColor:[UIColor whiteColor] forState:0];
    btn.titleLabel.font=[UIFont systemFontOfSize:16];
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    BarberDetailsTableViewCell *cell=[[BarberDetailsTableViewCell alloc] init];
    cell.model=_model;
    if (indexPath.row==0) {
        [cell setFrame:CGRectMake(0, 0, _mainW, [cell creawtView1])];
    }
    if (indexPath.row==1) {
       [cell creawtView2];
    }
    if (indexPath.row==2) {
        [cell setFrame:CGRectMake(0, 0, _mainW, [cell creatView3])];
    }
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}


-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==0) {
        UITableViewCell *cell;
        cell= [self tableView:tableView cellForRowAtIndexPath:indexPath];
        return cell.frame.size.height;
    }
    if (indexPath.row==1) {
        return 107;
    } if (indexPath.row==2) {
        UITableViewCell *cell;
        cell= [self tableView:tableView cellForRowAtIndexPath:indexPath];
        return cell.frame.size.height;
    }
    
    
    return 0;
    
}



@end
